package com.tts.service;
 	
import java.util.List;

import com.tts.dao.QueryDao;
import com.tts.domain.OrderForm;
import com.tts.domain.Train;
import com.tts.domain.User;

 	
 	public class QueryService {
 	
 		private QueryDao queryDao=new QueryDao();
 		
 		public List<Train> queryTrain(Train train) {
 			return queryDao.queryTrain(train);
 		}
 		public boolean loginUser(User user) {
 			return queryDao.checkUser(user.getUserName(), user.getPassword());
 		}
 		public boolean buyOrder(String userName,String password,OrderForm order)
 		{
 			if(queryDao.buyTickets(userName,password,order.getTrainId(),order.getTicketNumber())!=0)
 				return true;
 			else
 			return false; 
 		}
 		public boolean checkTrain(String trainId)
 		{
 			if(queryDao.checkTrain(trainId)==true)
 				return true;
 			else
 			return false;
 		}
 		
 	}